class Solution(object):
    def largestPerimeter(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        nums.sort(reverse=True)
        pointer_biggest, pointer_secoend, pointer_third = 0, 1, 2
        while pointer_third < len(nums):
            if nums[pointer_biggest] >= nums[pointer_secoend] + nums[pointer_third]:
                pointer_biggest += 1
                pointer_secoend += 1
                pointer_third += 1
            else:
                return  nums[pointer_biggest] + nums[pointer_secoend] + nums[pointer_third]
        return 0